package com.itheima.util;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;

public class RandomUtil {
    private static Random r = new Random();

    private RandomUtil() {

    }

    //生成姓名
    public static String getName() {
        StringBuilder sb = new StringBuilder();
        ArrayList<String> list = NameUtil.danXing();
        ArrayList<String> list1 = NameUtil.fuXing();
        ArrayList<String> zi = NameUtil.getZi();
        int i = r.nextInt(5);
        if (i == 0) {
            sb.append(list1.get(r.nextInt(list1.size())));
        } else {
            sb.append(list.get(r.nextInt(list.size())));

        }
        int i1 = r.nextInt(10);
        if (i1 == 0) {
            sb.append(zi.get(r.nextInt(zi.size())));
        } else {
            sb.append(zi.get(r.nextInt(zi.size())));
            sb.append(zi.get(r.nextInt(zi.size())));
        }

        return sb.toString();
    }

    //生成性别
    public static String getGender() {
        int i = r.nextInt(2);
        if (i == 0) {
            return "男";
        } else {
            return "女";
        }

    }

    //生成 生日
    public static LocalDate getBirthday() {

        LocalDate date = LocalDate.of(1995, 1, 1);
        LocalDate localDate = date.plusYears(r.nextInt(10)).plusMonths(r.nextInt(12)).plusDays(r.nextInt(31));
        return localDate;


    }

    //生成微信号

    public static ArrayList<String> getWxs() {
        ArrayList<String> list = new ArrayList<>();
        int i = r.nextInt(2);
        if (i == 0) {
            list.add(getWx());
        } else {
            list.add(getWx());
            list.add(getWx());
        }

        return list;
    }

    public static String getWx() {

        StringBuilder sb = new StringBuilder();
        StringBuilder wx = new StringBuilder();
        for (char i = 'a'; i <= 'z'; i++) {
            sb.append(i);
        }
        for (char i = 'A'; i <= 'Z'; i++) {
            sb.append(i);
        }
        for (char i = '0'; i <= '9'; i++) {
            sb.append(i);
        }
        int number = r.nextInt(11) + 10;//微信号长度
        for (int i = 0; i < number; i++) {//干随机长度的个数
            int i1 = r.nextInt(sb.length());//这个随机数决定了用哪一个字母
            char c = sb.charAt(i1);//拿到了这个字母
            wx.append(c);//字母拼接到微信号上
        }
        return wx.toString();
    }

    //生成手机号
    public static String getPhone() {
        StringBuilder sb = new StringBuilder("1");
        for (int i = 0; i < 10; i++) {
            sb.append(r.nextInt(10));
        }
        return sb.toString();
    }


}
